const Mock = require("mockjs");

const data = Mock.mock({
  "city|10": [
    {
      name: "@cname",
      "children|10-20": [
        {
          name: "@cname",
        },
      ],
    },
  ],
  "list|10-20": [
    {
      url: "@image(80x120, @color)",
      title: "@ctitle",
      word: "@cword(10, 20)",
      id: "@id",
    },
  ],
});

module.exports = (app) => {
  app.get("/api/city", (req, res) => {
    res.send({
      code: 200,
      data: data.city,
    });
  });

  app.get("/api/list", (req, res) => {
    res.send({
      code: 200,
      data: data.list,
    });
  });
};
